<?php
	include_once '../libraries/xl_loai_san_pham.php';
	$dt_xl_loai_san_pham=new xl_loai_san_pham;
	function kiem_tra_co_con_sp($ds_loai_san_pham, $ma) 
	{
		foreach ($ds_loai_san_pham as $loai_san_pham) 
		{
			if ($loai_san_pham['ma_loai_cha'] == $ma) return true;
		}
		return false;
	}
?>

<div class="art-vmenublock">
  <div class="art-vmenublock-body">
    <div class="art-vmenublockheader">
      <div class="l"></div>
      <div class="r"></div>
      <h3 class="t">DANH MỤC</h3>
    </div>
    <script>
	$(function() 
	{
		$( "#danh_muc" ).accordion(
		{
			autoHeight: false,
			navigation: true
			/*event: 'mouseover' */
		});
	});
	</script>
    <div class="demo">
      <div id="danh_muc">
	<?php
	$ds_loai_san_pham=$dt_xl_loai_san_pham->danh_sach_all();
	foreach ($ds_loai_san_pham as $loai_san_pham)
	{
		if ($loai_san_pham['ma_loai_cha']==0)
		{
	?>
        <h3 class="td_danhmuc"><a href="../danh-sach/<?php echo convert_vi_to_en($loai_san_pham['ten']).'-'.$loai_san_pham['ma']?>.html"><?php echo $loai_san_pham['ten']?></a></h3>
        <div>
  			<ul>
            <?php
            foreach ($ds_loai_san_pham as $loai_san_pham_con)
			{
				if($loai_san_pham_con['ma_loai_cha']==$loai_san_pham['ma'])
				{
			?>
            		<li><a href="../danh-sach/<?php $ma_cha=$dt_xl_loai_san_pham->xem($loai_san_pham_con['ma_loai_cha']);echo convert_vi_to_en($ma_cha['ten']).'-'.convert_vi_to_en($loai_san_pham_con['ten']).'-'.$loai_san_pham_con['ma']?>.html"><?php echo $loai_san_pham_con['ten']?></a></li>
            <?php
				}
			}			
			?>
            </ul>
         </div>
	<?php	
		}
	}
	?>
      </div>
    </div>
    <!-- End demo -->
    <div class="cleared"></div>
  </div>
</div>
